package cz.myslivec.slovicka.xml.converter;

import org.jboss.seam.annotations.AutoCreate;
import org.jboss.seam.annotations.In;
import org.jboss.seam.annotations.Name;

import cz.myslivec.slovicka.entity.Vocable;
import cz.myslivec.slovicka.util.converter.AConverterBase;
import cz.myslivec.slovicka.xml.model.VocableDTO;

@Name("vocableConverter")
@AutoCreate
public class VocableConverter extends AConverterBase<Vocable, VocableDTO> {

	@In
	LessonConverter lessonConverter;
	
	public VocableConverter() {
		super();
	}
	
	@Override
	protected VocableDTO getTo(VocableDTO result, Vocable from) {
		result.setId(from.getId());
		result.setStr1(from.getStr1());
		result.setStr2(from.getStr2());
		result.setStr3(from.getStr3());
		result.setStr4(from.getStr4());
		
		return result;
	}
	
	@Override
	protected Vocable getFrom(Vocable result, VocableDTO to) {
		result.setId(to.getId());
		result.setStr1(to.getStr1());
		result.setStr2(to.getStr2());
		result.setStr3(to.getStr3());
		result.setStr4(to.getStr4());
		
		return result;
	}
	
	@Override
	protected VocableDTO getToInstance() {
		return new VocableDTO();
	}
	
	@Override
	protected Vocable getFromInstance() {
		return new Vocable();
	}
}

